<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="include :: header"></head>
<body class="hold-transition skin-blue sidebar-mini">

<!--查看-->
<div class="modal fade" id="modal-info">
    <div class="modal-dialog" style="width:1300px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">变更记录查看</h4>
            </div>
            <div class="modal-body">
                <form id="info" class="form-horizontal">
                    <div class="col-md-12">
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 text-right control-label">项目编码</label>
                                <div class="col-sm-8">
                                    <span id="rpcProjectCode" class="form-control"></span>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 text-right control-label">项目名称</label>
                                <div class="col-sm-8">
                                    <span id="rpcProjectName" class="form-control"></span>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 text-right control-label">变更前物料描述</label>
                                <div class="col-sm-8">
                                    <span id="rpcMatDesc" class="form-control"></span>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 text-right control-label">变更后物料描述</label>
                                <div class="col-sm-8">
                                    <span id="rpcNewMatDesc" class="form-control"></span>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 text-right control-label">变更前数量</label>
                                <div class="col-sm-8">
                                    <span id="rpcNum" class="form-control"></span>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 text-right control-label">变更后数量</label>
                                <div class="col-sm-8">
                                    <span id="rpcNewNum" class="form-control"></span>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 text-right control-label">变更前单位</label>
                                <div class="col-sm-8">
                                    <span id="rpcUnit" class="form-control"></span>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 text-right control-label">变更后单位</label>
                                <div class="col-sm-8">
                                    <span id="rpcNewUnit" class="form-control"></span>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 text-right control-label">变更前型号/标准号</label>
                                <div class="col-sm-8">
                                    <span id="rpcStandardNo" class="form-control"></span>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 text-right control-label">变更后型号/标准号</label>
                                <div class="col-sm-8">
                                    <span id="rpcNewStandardNo" class="form-control"></span>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 text-right control-label">变更前品牌</label>
                                <div class="col-sm-8">
                                    <span id="rpcBrand" class="form-control"></span>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 text-right control-label">变更后品牌</label>
                                <div class="col-sm-8">
                                    <span id="rpcNewBrand" class="form-control"></span>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 text-right control-label">变更前备注</label>
                                <div class="col-sm-8">
                                    <span id="rpcRemark" class="form-control"></span>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 text-right control-label">变更后备注</label>
                                <div class="col-sm-8">
                                    <span id="rpcNewRemark" class="form-control"></span>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 text-right control-label">变更前是否使用库存</label>
                                <div class="col-sm-8">
                                    <span id="rpcUseStore" class="form-control"></span>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 text-right control-label">变更后是否使用库存</label>
                                <div class="col-sm-8">
                                    <span id="rpcNewUseStore" class="form-control"></span>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 text-right control-label">变更前图号</label>
                                <div class="col-sm-8">
                                    <span id="rpcDiagram" class="form-control"></span>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 text-right control-label">变更后图号</label>
                                <div class="col-sm-8">
                                    <span id="rpcNewDiagram" class="form-control"></span>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 text-right control-label">变更前外协类型</label>
                                <div class="col-sm-8">
                                    <span id="rpcAssistType" class="form-control"></span>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label class="col-sm-4 text-right control-label">变更后外协类型</label>
                                <div class="col-sm-8">
                                    <span id="rpcNewAssistType" class="form-control"></span>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>
<section class="content-header"><h1>提报计划变更查询</h1></section>
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <form id="queryForm" onsubmit="return false;">
                        <div class="row">
                            <div class="form-inline">
                                <div class="form-group">
                                    <label>项目编号</label>
                                    <input type="text" name="rpcNewProjectCode" class="form-control" placeholder="请输入项目编号">
                                </div>
                                <div class="form-group">
                                    <label>项目名称</label>
                                    <input type="text" name="rpcNewProjectName" class="form-control" placeholder="请输入项目名称">
                                </div>
                                <div class="form-group">
                                    <label>物料描述</label>
                                    <input type="text" name="rpcNewMatDesc" class="form-control" placeholder="请输入采购物料描述">
                                </div>
                                <div class="form-group">
                                    <label>计划员</label>
                                    <input type="text" name="rpcNewPlanner" class="form-control" placeholder="请输入计划员">
                                </div>
                                <div class="form-group">
                                    <label>提报人</label>
                                    <input type="text" name="rpcNewDesigner" class="form-control" placeholder="请输入提报人">
                                </div>
                                <button type="button" class="btn btn-success" id="btn-search">
                                    <span class="Bold">搜索</span>
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="box-body">
                    <table id="bootstrap-table"></table>
                </div>
            </div>
        </div>
    </div>
</section>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    let table;
    /** 查看 */
    function openInfoModal(rpcId) {
        if($("#rpcMatDesc").html()!=$("#rpcNewMatDesc").html()){
            $("#rpcNewMatDesc").css('color','#555555');
        }
        if($("#rpcNum").html()!=$("#rpcNewNum").html()){
            $("#rpcNewNum").css('color','#555555');
        }
        if($("#rpcUnit").html()!=$("#rpcNewUnit").html()){
            $("#rpcNewUnit").css('color','#555555');
        }
        if($("#rpcStandardNo").html()!=$("#rpcNewStandardNo").html()){
            $("#rpcNewStandardNo").css('color','#555555');
        }
        if($("#rpcBrand").html()!=$("#rpcNewBrand").html()){
            $("#rpcNewBrand").css('color','#555555');
        }
        if($("#rpcRemark").html()!=$("#rpcNewRemark").html()){
            $("#rpcNewRemark").css('color','#555555');
        }
        if($("#rpcUseStore").html()!=$("#rpcNewUseStore").html()){
            $("#rpcNewUseStore").css('color','#555555');
        }
        if($("#rpcDiagram").html()!=$("#rpcNewDiagram").html()){
            $("#rpcNewDiagram").css('color','#555555');
        }
        if($("#rpcAssistType").html()!=$("#rpcNewAssistType").html()){
            $("#rpcNewAssistType").css('color','#555555');
        }
        let row = $("#bootstrap-table").bootstrapTable('getRowByUniqueId', rpcId);
        $("#info").fillSpan(row);
        if($("#rpcNewUseStore").html()!=undefined && $("#rpcNewUseStore").html()===''){
            $("#rpcNewUseStore").html('');
        }else if($("#rpcNewUseStore").html()!=undefined && Number($("#rpcNewUseStore").html())===1){
            $("#rpcNewUseStore").html('是');
        }else if($("#rpcNewUseStore").html()!=undefined && Number($("#rpcNewUseStore").html())===0){
            $("#rpcNewUseStore").html('否');
        }
        if($("#rpcUseStore").html()!=undefined && $("#rpcUseStore").html()===''){
            $("#rpcUseStore").html('');
        }else if($("#rpcUseStore").html()!=undefined && Number($("#rpcUseStore").html())===1){
            $("#rpcUseStore").html('是');
        }else if($("#rpcUseStore").html()!=undefined && Number($("#rpcUseStore").html())===0){
            $("#rpcUseStore").html('否');
        }
        if($("#rpcMatDesc").html()!=$("#rpcNewMatDesc").html()){
            $("#rpcNewMatDesc").css('color','red');
        }
        if($("#rpcNum").html()!=$("#rpcNewNum").html()){
            $("#rpcNewNum").css('color','red');
        }
        if($("#rpcUnit").html()!=$("#rpcNewUnit").html()){
            $("#rpcNewUnit").css('color','red');
        }
        if($("#rpcStandardNo").html()!=$("#rpcNewStandardNo").html()){
            $("#rpcNewStandardNo").css('color','red');
        }
        if($("#rpcBrand").html()!=$("#rpcNewBrand").html()){
            $("#rpcNewBrand").css('color','red');
        }
        if($("#rpcRemark").html()!=$("#rpcNewRemark").html()){
            $("#rpcNewRemark").css('color','red');
        }
        if($("#rpcUseStore").html()!=$("#rpcNewUseStore").html()){
            $("#rpcNewUseStore").css('color','red');
        }
        if($("#rpcDiagram").html()!=$("#rpcNewDiagram").html()){
            $("#rpcNewDiagram").css('color','red');
        }
        if($("#rpcAssistType").html()!=$("#rpcNewAssistType").html()){
            $("#rpcNewAssistType").css('color','red');
        }
        js.modal.open("modal-info");
    }
    $(function () {
        $("title").html($("title").html()+" —— 提报计划变更查询");
        /** 初始化表格 */
        table = js.table.init({
            url: ctx + "plan/changeQuery/list",
            showExport: false,
            showColumns: false,
            uniqueId:"rpcId",
            columns: [
                {
                    title: '序号', width: '50px',
                    formatter: function (value, row, index, field) {
                        return index + 1;
                    }
                },
                { title: "项目编号", field: 'rpcProjectCode'},
                { title: "项目名称", field: 'rpcProjectName'},
                { title: "变更后<br>物料描述", field: 'rpcNewMatDesc'},
                { title: "变更后<br>数量", field: 'rpcNewNum'},
                { title: "变更后<br>单位", field: 'rpcNewUnit'},
                { title: "变更后<br>型号/标准号", field: 'rpcNewStandardNo'},
                { title: "变更后<br>品牌", field: 'rpcNewBrand'},
                { title: "变更后<br>备注", field: 'rpcNewRemark'},
                { title: "变更后<br>是否使用库存", field: 'rpcNewUseStore'},
                { title: "变更后<br>图号", field: 'rpcNewDiagram'},
                { title: "变更后<br>外协类型", field: 'rpcNewAssistType'},
                { title: "计划员", field: 'rpcNewPlanner'},
                { title: "提报人", field: 'rpcNewDesigner'},
                { title: "变更原因", field: 'rpcReason'},
                {
                    title: "操作",
                    width: '60px',
                    formatter: function (value, row, index) {
                        let actions = [];
                        if (hasP("buychange:planchangequery:view")) {
                            actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="openInfoModal(' + row.rpcId + ')"> 查看</a> ');
                        }
                        return actions.join('');
                    }
                }
            ]
        });
        /** 表格搜索 */
        $("#btn-search").click(function () {
            js.table.search(table);
        });



    });

</script>
</body>
</html>
